﻿
@{
    ViewBag.Title = "BaseMedicineQuery";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<form name="form1">
    <div class="panel panel-default">
        <div class="panel-heading navb-bg">
            筛选条件
        </div>
        <table class="form">
            <tr>
                <td class="formTitle">
                    执行类别：
                </td>
                <td class="formValue">
                    <select class="form-control" id="zxdlb">
                        <option value="">请选择</option>
                        <option value="ynyp">院内药品</option>
                        <option value="zlxm">诊疗项目</option>
                        <option value="ynhc">院内耗材</option>
                    </select>
                <td class="formTitle">
                    项目编码：
                </td>
                <td class="formValue">
                    <input id="xmbm" type="text" class="form-control">
                </td>
                <td class="formTitle">
                    项目名称：
                </td>
                <td class="formValue"> <input id="xmmc" type="text" class="form-control"></td>
                <td class="formTitle">
                    <input id="ck_kc" type="checkbox" /><label for="ck_kc">不显示零库存</label>
                </td>
                <td class="formValue">
                    <input type="button" id="btn_search" class="btn btn-md btn-primary" style="width:80px;" value="查询" />
                </td>
                <td class="formTitle">
                </td>
                <td class="formValue">
                </td>
                <td class="formTitle">
                </td>
                <td class="formValue">
                    
                </td>
                
            </tr>
        </table>
    </div>
    <div class="gridPanel" style="margin-top:10px">
        <table id="gridList"></table>
        <div id="gridPager" rel="form1"></div>
    </div>
</form>
<script>
    $(function () {
        //浏览器窗口调整大小时重新加载jqGrid的宽
        $(window).resize(function () {
            initLayout("gridPanel");
        });
        gridList();
    });

    function gridList() {
        var $gridList = $("#gridList");
        //var obj = new Object();
        //obj.mbmc = $('#mbmc').val();
        //obj.mblx = $('#mblx').val();
        var zxdlb = $("#zxdlb").val();
        var xmbm = $("#xmbm").val();
        var ck_kc = "1";
        if ($('#ck_kc').is(':checked')) {
            ck_kc = "0";
        }
        $gridList.dataGrid({
            postData: { zxdlb: $("#zxdlb").val(), xmbm: xmbm, xmmc: $("#xmmc").val(), ck_kc: ck_kc},
            url: "/MedicalRecord/GetBaseMedicinetList",
            height: $(window).height() - 130,
            shrinkToFit: true,   //true:按比例初始化列宽度 false:使用colModel指定的宽度
            autowidth: true,
            colModel: [
                { label: "项目编码", name: "ypCode", width: 70, align: 'left' },
                { label: '项目名称', name: 'ypmc', width: 180, align: 'left' },
                { label: '费用类别', name: 'yplb', width: 50, align: 'left' },
                { label: '库存数量', name: 'klsl', width: 70, align: 'left' },
                //{ label: '药品属性', name: 'ypxzmc', width: 50, align: 'left' },
                { label: '规格', name: 'ypgg', width: 100, align: 'left' },
                { label: '零售价', name: 'lsj', width: 50, align: 'left' },
                { label: '批发价', name: 'pfj', width: 50, align: 'left' },
                { label: '单位', name: 'deptdw', width: 50, align: 'left' },
                { label: '生产厂家', name: 'ycmc', width: 150, align: 'left' },
                { label: '使用状态', name: 'syzt', width: 50, align: 'left' },
                { label: '停用标志', name: 'ypzt', width: 65, align: 'left' },
                { label: "主键", name: "ypId", hidden: true, key: true },
                { label: '部门编码', name: 'yfbmCode', width: 80, align: 'left' },
                { label: '部门名称', name: 'yfbmmc', width: 100, align: 'left' }
            ],
            pager: "#gridPager",
            sortname: 'ypmc asc',
            viewrecords: true,
            gridComplete: function () {
              
            }
        });
        $("#btn_search").click(
            
            function () {
                var ck_kc = "1";
                if ($('#ck_kc').is(':checked')) {
                    ck_kc = "0";
                }
            $gridList.jqGrid('setGridParam', {
                postData: { zxdlb: $("#zxdlb").val(), xmbm: $("#xmbm").val(), xmmc: $("#xmmc").val(), ck_kc: ck_kc },
                pager: "#gridPager",
                sortname: 'ypmc asc',
            }).trigger('reloadGrid');
        });
    }

</script>